package Decorator;

import java.util.*;

public abstract class PizzaBase {

    //protected double totalPrice;
    //protected ArrayList<PizzaBase> pb;
    protected String name = "";
    protected double price = 0.0;
    protected static ArrayList<PizzaBase> pbs = new ArrayList<PizzaBase>();

    public double getTotalPrice() {

        double totalPrice = 0;
        for (PizzaBase pb : pbs) {
            totalPrice += pb.price;
        }

        totalPrice += this.price;

        return totalPrice;
    }

    public String getNames() {

        String tName = "";

        for (PizzaBase pb : pbs) {
            tName += " " + pb.name;
        }

        tName += " " + this.name;
        return tName;

    }
}
